<template>
  <div class="app-container">
    <el-card style="height: 100%; display: flex; flex-direction: column; justify-content: space-between;">
      <div>
        <h1 style="text-align: center;">{{ recruit.title }}</h1>
        <h5 style="text-align: center;">更新时间：{{ recruit.updateTime }}</h5>
      </div>

      <el-form ref="form" :model="form" :rules="rules" label-width="80px" style="margin-top: 50px;">
        <el-form-item label="简历标题" prop="title">
          <el-input v-model="form.title" placeholder="请输入简历标题" />
        </el-form-item>
        <el-form-item label="简历文件" prop="file">
          <file-upload v-model="form.file"/>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div style="display: flex; justify-content: center;margin-top: 50px;">
        <el-button type="success" @click="submitForm" style="width: 150px;">投递</el-button>
        <!-- <el-button @click="cancel">取 消</el-button> -->
      </div>
    </el-card>
  </div>
</template>

<script>

import { listCv, getCv, delCv, addCv, updateCv,getRecruitCvProgress } from "@/api/system/cv";
import { listRecruit, getRecruit, delRecruit, addRecruit, updateRecruit } from "@/api/system/recruit";

export default {
  name: "AddRecruit",
  data() {
    return {
      recruitId: null,
      recruit: null,
      form: {},
        // 表单校验
        rules: {
          title: [
            { required: true, message: "简历标题不能为空", trigger: "blur" }
          ],
          file: [
            { required: true, message: "简历不能为空", trigger: "blur" }
          ]
        }
    };
  },
  created() {
    this.getCVItem();
  },
  methods: {
    getCVItem(){
      const id = this.$route.query.id;
      this.form.recruitId = id;
      getRecruit(id).then(res => {
        this.recruit = res.data
      })
    },
    submitForm(){
      addCv(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
      });
    }
  }
};
</script>
